#include "buletooth.h"
#include "delay.h"

char* B_CheckData(char *data) // 检查数据
{
    char *strx = 0;
    strx = strstr((const char*)USART3_RX_BUF, (const char*)data);
    return strx;
}

void B_SendData(USART_TypeDef *USARTx, char *fmt,...) // 发送数据
{
	unsigned char UsartPrintfBuf[256] = {	0	};
	va_list ap;
	unsigned char *pStr = UsartPrintfBuf;
	
	va_start(ap, fmt);
	vsnprintf((char *)UsartPrintfBuf, sizeof(UsartPrintfBuf), fmt, ap);							//格式化
	va_end(ap);
	
	while(*pStr != 0){
		//USART_SendData(BUSARTTYPE, *pStr++);
		BUSARTTYPE->DR = (*pStr++ & (uint16_t)0x01FF);
		while(USART_GetFlagStatus(BUSARTTYPE, USART_FLAG_TC) == RESET);
	}
	delay_ms(TRANS_TIME);
}
